package com.pd.web.util;


import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by dong peng on 2018/1/21.
 */
public class UrlUtil {

    /**
     * 判断请求接收是否是json格式
     * @param request
     * @return
     */
    public static boolean isAjax(HttpServletRequest request) {
        String accept = request.getHeader("Accept");
        if(StringUtils.isNotEmpty(accept) && (accept.contains("application/json") || accept.contains("application/jsonp"))) {
            return true;
        }

        return false;
    }
}
